#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>

#include "status.h"

int
get_hour(Arg * arg)
{
	time_t rawtime = time(NULL);
	struct tm * time = localtime(&rawtime);
	return time->tm_hour;
}

int
get_minute(Arg * arg)
{
	time_t rawtime = time(NULL);
	struct tm * time = localtime(&rawtime);
	return time->tm_min;
}

long double
get_time(Arg * arg)
{
    struct timespec time;

    if (clock_gettime(CLOCK_REALTIME, &time) == -1) {
        printf("Error at clock_gettime in get_time()\n");
        exit(1);
    }

    return (long double) time.tv_sec + (time.tv_nsec / 1000000000.0);
}

